package com.example.demo.jvm;

import java.util.ArrayList;
import java.util.List;

/**
 * 方法区和运行时常量池溢出
 *
 * @author luowj12
 * @since 2021/5/25 10:19
 */
public class StringOomMock {

    static String  base = "string";
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        for (int i=0;i< Integer.MAX_VALUE;i++){
            String str = base + base;
            base = str;
            list.add(str.intern());
        }
    }

}
